//
//  CalendarHeaderView.m
//  CarFile
//
//  Created by 陈浩 on 2017/7/19.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CalendarHeaderView.h"


#define HeaderViewHeight 30
#define WeekViewHeight 40
@interface CalendarHeaderView()
@property (nonatomic ,strong) UILabel *monthLabel;
@end
@implementation CalendarHeaderView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        UILabel *monthLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, UIScreenW, 44)];
        monthLabel.text = @"   7月";
        monthLabel.textColor = [UIColor colorWithHexString:@"666666" alpha:1.0f];
        monthLabel.font = [UIFont fontWithName:@"HiraKakuProN-W3"size:18];
        [self addSubview:monthLabel];
        self.monthLabel = monthLabel;
        
        UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 44, UIScreenW, 1)];
        line.backgroundColor = [UIColor colorWithHexString:@"999999" alpha:0.1f];
        [self addSubview:line];
        
        NSArray *weekArray = [[NSArray alloc] initWithObjects:@"日",@"一",@"二",@"三",@"四",@"五",@"六", nil];
        
        for (int i=0; i<weekArray.count; i++) {
            UILabel *weekLabel = [[UILabel alloc] initWithFrame:CGRectMake(i*Iphone6Scale(54), 45 +10, Iphone6Scale(54), HeaderViewHeight)];
            weekLabel.textAlignment = NSTextAlignmentCenter;
            weekLabel.textColor = [UIColor grayColor];
            weekLabel.font = [UIFont systemFontOfSize:16.f];
            weekLabel.text = weekArray[i];
            [self addSubview:weekLabel];
        }
        
    }
    return self;
    
}

-(void)setMonthStr:(NSString *)monthStr{
    _monthStr = monthStr;
    self.monthLabel.text = monthStr;
}


@end
